/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package br.ufscar.compiladores.ast;

/**
 *
 * @author takeshi
 */
public class ForCommand extends Command {

    private Variable forVariable;
    private Expr exprStart, exprEnd;
    private Command command;

    public ForCommand(Variable forVariable, Expr exprStart, Expr exprEnd, Command command) {
        this.forVariable = forVariable;
        this.exprStart = exprStart;
        this.exprEnd = exprEnd;
        this.command = command;
    }

    @Override
    public void genC(PW pw) {
//        pw.print("for ( " + forVariable.getName() + " = ");
//        exprStart.genC(pw, false);
//        pw.out.print("; " + forVariable.getName() + " <= ");
//        exprEnd.genC(pw, false);
//        pw.out.println("; " + forVariable.getName() + "++ )");
//        if (statement != null) {
//            if (statement instanceof CompositeStatement) {
//                statement.genC(pw);
//            } else {
//                pw.add();
//                statement.genC(pw);
//                pw.sub();
//            }
//        }
    }
}
